package br.ufrj.dcc.thalles;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

public class Entrar extends Activity {
	String conta;
	String senha;
	boolean valido;
	LoginChecker checker;

	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.entrar);
    }
	public void	checarLogin(View v){
		conta=((EditText) findViewById(R.id.editConta)).getText().toString();
		senha=((EditText)findViewById(R.id.editSenha)).getText().toString();
		checker= new LoginChecker(this);
		valido = checker.check(conta, senha);
		if (!valido){
			Log.d("não logou", "não logou");
			Toast.makeText(getApplicationContext(), "Dados inválidos", Toast.LENGTH_SHORT).show();
		
		}
		else{
			Intent proximo=new Intent(Entrar.this, Operacao.class);
			Bundle pacote=new Bundle();
			pacote.putString("conta", conta);
			pacote.putString("senha",senha);
			proximo.putExtras(pacote);
			startActivity(proximo);
			
		}
	}

}
